import './public-path.js' // 让logo显示出来 但一定要放在最前面
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App.tsx';
import reportWebVitals from './reportWebVitals';
import { BrowserRouter } from 'react-router-dom';

const root = ReactDOM.createRoot(document.getElementById('root'));
// root.render(
//   <React.StrictMode>
//     <App />
//   </React.StrictMode>
// );

export async function bootstrap() {
  console.log('[react16] react app bootstraped');
}

export async function mount(props) {
  root.render(
    <BrowserRouter basename={window.__POWERED_BY_QIANKUN__ ? '/micro-app2' : '/' }>
      <App />
    </BrowserRouter>,
  )
}

export async function unmount(props) {
  const { container } = props;
  root.unmountComponentAtNode(container ? container.querySelector('#root') : document.querySelector('#root'));
}


if (!window.__POWERED_BY_QIANKUN__) {
  root.render(
    <BrowserRouter>
      <App />
    </BrowserRouter>,
    // document.getElementById('root')
  );
}

reportWebVitals();
